package com.xiaopengpeng.test;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

public class HbaseConnetcion {
	private static Connection  connection= null;
	public static synchronized Connection getConnection(){
		if(connection!=null){
			return connection;
		}
		Configuration conf = HBaseConfiguration.create();
		try {
			Connection createConnection = ConnectionFactory.createConnection(conf);
			connection = createConnection;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return connection;
	}

}
